package com.awei.study.design.found.singleton;

/**
 * 懒汉式3 双重检查锁
 */
public class SingletonL3 {

    private SingletonL3() {}

    private static volatile SingletonL3 instance;

    //
    public  SingletonL3 getInstance() {
        if(instance == null) {
            synchronized(SingletonL3.class) {
                if( instance == null)
                    return new SingletonL3();
            }
        }
        return instance;
    }
}
